home *** CD-ROM | disk | FTP | other *** search
/ Languguage OS 2 / Languguage OS II Version 10-94 (Knowledge Media)(1994).ISO / language / pcpil / sample11.pil < prev    next >
Text File  |  1979-12-31  |  3KB  |  126 lines

  1. TS:M2
  2. T:Student restart example.
  3. :
  4. :Each time you run this program you are asked for a 9-digit ID
  5. :number. You can leave the program at any time by pushing the ESC  
  6. :key. When you run again with the same ID number you are
  7. :restarted at the place you left off.  
  8. :
  9. :This is accomplished by saving a restart indicator along with
  10. :each ID number in the file SAMPLE11.REC. After you run this program
  11. :with various ID numbers, stopping at various sections, you can look
  12. :at the restart file by the command   TYPE SAMPLE11.REC
  13. :
  14. R: record layout: REC$(1,9 ) = student id number
  15. R:                REC$(10,1) = a blank character
  16. R:                REC$(11,2) = section number at which to restart next time
  17. R:                REC$(13,2) = RETURN and LINE-FEED characters
  18. R: next variable, RECZ, is the length of each record .
  19. C: RECZ = 14
  20. D: ID$(9), REC$(RECZ)
  21.  
  22. R:Determine students identity.
  23.  
  24. T:
  25. *IDNO
  26. T:Please enter your 9-digit ID number:
  27. A:$ID$
  28. J(LEN(%B)<7):IDNO
  29.  
  30. R: See if student already on file by reading through the file  SAMPLE11.REC
  31.  
  32. FX:SAMPLE11.REC
  33. C: RECNO = 0
  34.  
  35. *FIND
  36. FI:RECNO*RECZ,REC$
  37. J(ASC(REC$) = 255):EOF
  38. J(ID$ = REC$(1,9)):FOUND
  39. C:RECNO = RECNO+1
  40. J:FIND
  41.  
  42. *EOF  T:That student ID is not on file.
  43. *EOF1
  44. T:
  45. :   Enter   Q   to QUIT right now
  46. :      or   S   to START running the program
  47. :
  48. A:
  49. M:Q!q
  50. EY:
  51. M:S!s
  52. JN:EOF1
  53.  
  54. C:PART = 1
  55. T:
  56. T:There are 4 sections in this program. You will start at section #PART.
  57. J: GO
  58.  
  59. *FOUND
  60. C:PART = REC$(11,2)
  61. T(PART >= 5):You have previously completed all sections.
  62. EC:
  63. T:You left off at section #PART.  We can restart at that piont.
  64.  
  65. R:Enable ESCAPE option, then go to appropriate section.
  66. *GO P:E
  67. W:40
  68. X: "J:SECT" !! PART
  69.  
  70.  
  71. R: Come here if student pushes ESC at any time indicating he wishes to leave.
  72.  
  73. *SYSX
  74. T:Program interupted...
  75.  
  76. T:Next time you run the program you will start at section #PART.
  77. *DONE
  78. C: REC$(1,9) = ID$
  79. C: REC$(11,2) = PART
  80. C: REC$(13,2) = CHR(13) !! CHR(10)
  81. FO:RECNO*RECZ,REC$
  82. FX:
  83. *EXIT E:*EXIT
  84.  
  85. *SECT1
  86. TX:Section 1
  87. :push Enter to go on to the next section,
  88. :or push ESC to stop at this point. 
  89. A:
  90. T:Section 1 completed.
  91. W:20
  92. C:PART = 2
  93.  
  94. *SECT2
  95. TX:Section 2
  96. :push Enter to go on to the next section,
  97. :or push ESC to stop at this point. 
  98. A:
  99. T:Section 2 completed.
  100. W:20
  101. C:PART = 3
  102.  
  103. *SECT3
  104. TX:Section 3
  105. :push Enter to go on to the next section,
  106. :or push ESC to stop at this point. 
  107. A:
  108. T:Section 3 completed.
  109. W:20
  110. C:PART = 4
  111.  
  112. *SECT4
  113. TX:Section 4
  114. :push Enter to go on to the next section,
  115. :or push ESC to stop at this point. 
  116. A:
  117. T:Section 4 completed.
  118. W:20
  119. C:PART = 5
  120.  
  121. TX:All sections completed.
  122. W:20
  123. J:DONE
  124.  
  125.  
  126.